home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <intuition/intuition.h>
- #include <intuition/screens.h>
- #include <libraries/gadtools.h>
- #include <clib/intuition_protos.h>
- #include <clib/exec_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/rtracker_protos.h>
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/gadtools_protos.h>
- #include <pragmas/rtracker_pragmas.h>
- #include <exec/libraries.h>
- #include <exec/memory.h>
- #include <exec/ports.h>
- #include <dos/dos.h>
-
- #include "main.h"
- #include "choice.h"
- extern struct Library * RTrackerBase ;
- extern struct Library * GadToolsBase ;
-
- LONG type =0 ;
- BOOL stop ;
-
- void ProcessWindowCH1( LONG Class, UWORD Code, APTR IAddress ) {
- struct Gadget *gad;
- switch ( Class )
- {
- case IDCMP_GADGETDOWN :
- gad = (struct Gadget *)IAddress ;
- type = NULL ;
- GT_GetGadgetAttrs(gad, CH1, NULL, GTMX_Active, &type) ;
- break ;
- case IDCMP_GADGETUP :
- /* Gadget message, gadget = gad. */
- gad = (struct Gadget *)IAddress;
- switch ( gad->GadgetID )
- {
- case CH1_BUT1 :
- /* Button pressed , Text of gadget : Save */
- stop = TRUE ;
- break;
- case CH1_BUT2 :
- /* Button pressed , Text of gadget : Cancel */
- type=-1 ; // cancel
- stop = TRUE ;
- break;
- }
- break;
- case IDCMP_CLOSEWINDOW :
- /* CloseWindow Now */
- type=-1 ;
- stop = TRUE ;
- break;
- case IDCMP_REFRESHWINDOW :
- GT_BeginRefresh( CH1);
- /* Refresh window. */
- RendWindowCH1( CH1, CH1VisualInfo );
- GT_EndRefresh( CH1, TRUE);
- GT_RefreshWindow( CH1, NULL);
- RefreshGList( CH1GList, CH1, NULL, ~0);
- break;
- }
- }
-
- LONG choice() {
- ULONG class,
- code ;
- struct Gadget * pgsel ;
- struct IntuiMessage * imsg ;
- stop = FALSE ;
-
- if (!OpenWindowCH1()) {
- /* open the window
- */
- do {
- WaitPort(CH1->UserPort) ;
- while(imsg = GT_GetIMsg(CH1->UserPort)) {
- /* got a message
- */
- class = imsg->Class ;
- code = imsg->Code ;
- pgsel = (struct Gadget*)imsg->IAddress ;
- GT_ReplyIMsg(imsg) ;
- // printf("Class: %x Code: %ld\n Gad: %x\n", class, code, pgsel) ;
- ProcessWindowCH1(class, code, pgsel) ;
- }
- }while(!stop) ;
- CloseWindowCH1() ;
- }else
- printf("Can't open window\n") ;
- return(type) ;
- }
-